<?php

if (validation_errors()) :
?>
<section class="content-header">
<div class='alert alert-block alert-error fade in'>
    <a class='close' data-dismiss='alert'>&times;</a>
    <h4 class='alert-heading'>
        <?php echo lang('hotcity_errors_message'); ?>
    </h4>
    <?php echo validation_errors(); ?>
</div>
</section>
<?php
endif;

$id = isset($hotcity->id) ? $hotcity->id : '';

?>

<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-xs-12">
        <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">新增<?php echo lang('hotcity_area_title'); ?></h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <?php echo form_open($this->uri->uri_string(), 'class="form-horizontal"'); ?>
              <div class="box-body">
                <div class="form-group">
                  <?php echo form_label('城市' . lang('bf_form_label_required'), 'city_id', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-sm-5">
                        <select class="form-control select2" style="width: 100%;" name="city_id" id="city_id">
                          <option selected="selected" value="0">选择城市</option>
                          <?php foreach ($cities as $city) : ?>
                            <option value="<?php echo $city->area_id; ?>" <?php if($city->area_id == $hotcity->city_id):?>selected='selected'<?php endif;?>><?php echo $city->area_name; ?></option>
                          <?php endforeach; ?>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                  <?php echo form_label('排序', 'rank', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-sm-5">
                        <input type='text' name="rank" class="form-control" value="<?php echo set_value('rank', isset($hotcity->rank) ? $hotcity->rank : ''); ?>" placeholder="正序排序、请填写数字" />
                    </div>
                </div>
                <div class="form-group">
                    <?php echo form_label('上传图片', '', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-md-10">
                        <div id="container">
                            <a class="btn btn-default btn-lg " id="img_pickfiles" href="#" >
                                <i class="glyphicon glyphicon-plus"></i>
                                <span>图片</span>
                            </a>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                  <?php echo form_label('图片', 'pic', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-sm-10" id="hometop_pic_list">
                    <div style="float: left;"><img id="hotcity_pic" src="<?php echo $hotcity->absolute_url; ?>" width="100" style="padding-right:5px;"><input id="url" type="hidden" name="url" value="<?php echo $hotcity->url; ?>" style="display:none;"></div>
                    </div>
                </div>

                <div class="form-group">
                    <?php echo form_label('', '', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-md-10" id="pic_list">
                                  
                    </div>
                </div>

              </div>
              <!-- /.box-body -->

              <div class="box-footer">
                <button type="submit" name='save' class="btn btn-primary">提交</button>
                <?php echo anchor(SITE_AREA . '/home/hotcity', '取消', 'class="btn btn-default pull-right"'); ?>
              </div>
            <?php echo form_close(); ?>
          </div>

          </div>
      </div>
</section>
